CFLAGS := -DD -g -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align \
	-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations \
	-Wredundant-decls -Wnested-externs -Winline -Wno-long-long \
	-Wconversion

all: seg 
	$(MAKE) -C input
	$(MAKE) -C output
	$(MAKE) -C meta

seg: main.o command.o plugin.o event.o
	gcc $(CFLAGS) main.o command.o plugin.o event.o -o seg

main.o: main.c seg.h
	gcc $(CFLAGS) -c main.c -o main.o

command.o: command.c command.h seg.h
	gcc $(CFLAGS) -c command.c -o command.o

plugin.o: plugin.c plugin.h seg.h
	gcc $(CFLAGS) -c plugin.c -o plugin.o

event.o: event.c event.h seg.h
	gcc $(CFLAGS) -c event.c -o event.o

seg.h: plugin.h command.h event.h

clean:
	rm -f *.o seg core
	$(MAKE) -C input/ clean
	$(MAKE) -C output/ clean
	$(MAKE) -C meta/ clean
